package cn.itsource.org.controller;

import cn.itsource.basic.util.AjaxResult;
import cn.itsource.org.dto.LoginDto;
import cn.itsource.org.service.IEmployeeService;
import cn.itsource.org.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private IEmployeeService employeeService;

    @Autowired
    private IUserService userService;

    /**
     * 后台登录
     * @param loginDto
     * @return
     */
    @PostMapping("/system/login")
    public AjaxResult login(@RequestBody LoginDto loginDto){

        //登录业务
        return employeeService.login(loginDto);
    }

    /**
     * 用户系统登录
     * @param loginDto
     * @return
     */
    @PostMapping("/user/login")
    public AjaxResult userLogin(@RequestBody LoginDto loginDto){


        //登录业务
        return userService.login(loginDto);
    }


}
